package dcartes.image;

import java.awt.image.renderable.ParameterBlock;

import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.operator.TransposeDescriptor;

public class Transpose{



    public static PlanarImage FlipVertical( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.FLIP_VERTICAL );

        dst =  JAI.create( "transpose", pb );

        return dst;
    }

    public static PlanarImage FlipHorizontal( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.FLIP_HORIZONTAL );

        dst =  JAI.create( "transpose", pb );

        return dst;

    }

    public static PlanarImage FlipDiagonal( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.FLIP_DIAGONAL );

        dst =  JAI.create( "transpose", pb );

        return dst;

    }

    public static PlanarImage FlipAntidiagonal( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.FLIP_ANTIDIAGONAL );

        dst =  JAI.create( "transpose", pb );

        return dst;

    }

    public static PlanarImage Rot90( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.ROTATE_90 );

        dst =  JAI.create( "transpose", pb );

        return dst;

    }

    public static PlanarImage Rot180( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.ROTATE_180 );

        dst =  JAI.create( "transpose", pb );

        return dst;

    }

    public static PlanarImage Rot270( PlanarImage src ) {

        PlanarImage dst;

        ParameterBlock pb = new ParameterBlock();
        pb.addSource( src );
        pb.add( TransposeDescriptor.ROTATE_270 );

        dst =  JAI.create( "transpose", pb );

        return dst;
    }


}